<title>Options</title>
<variablelist>
+ <varlistentry>
+ <term><option>--list</option></term>
+
+ <listitem><para> For historical reasons, <literal>refs</literal>
+ without this option will strip the specified prefix
+ from the output. Normally, one wants to see the full
+ ref, so providing this option ensures the refs are
+ printed in full, rather than
+ truncated. </para></listitem>
+ </varlistentry>
<varlistentry>
<term><option>--delete</option></term>
#include "ostree.h"
static gboolean opt_delete;
+static gboolean opt_list;
static GOptionEntry options[] = {
{ "delete", 0, 0, G_OPTION_ARG_NONE, &opt_delete, "Delete refs which match PREFIX, rather than listing them", NULL },
+ { "list", 0, 0, G_OPTION_ARG_NONE, &opt_list, "Do not remove the prefix from the refs", NULL },
{ NULL }
};
gpointer hashkey, hashvalue;
gboolean ret = FALSE;
- if (!opt_delete)
+ if (opt_delete || opt_list)
{
- if (!ostree_repo_list_refs (repo, refspec_prefix, &refs, cancellable, error))
+ if (!ostree_repo_list_refs_ext (repo, refspec_prefix, &refs, OSTREE_REPO_LIST_REFS_EXT_NONE,
+ cancellable, error))
goto out;
+ }
+ else if (!ostree_repo_list_refs (repo, refspec_prefix, &refs, cancellable, error))
+ goto out;
+ if (!opt_delete)
+ {
g_hash_table_iter_init (&hashiter, refs);
while (g_hash_table_iter_next (&hashiter, &hashkey, &hashvalue))
{
}
else
{
- if (!ostree_repo_list_refs_ext (repo, refspec_prefix, &refs, OSTREE_REPO_LIST_REFS_EXT_NONE,
- cancellable, error))
- goto out;
-
g_hash_table_iter_init (&hashiter, refs);
while (g_hash_table_iter_next (&hashiter, &hashkey, &hashvalue))
{
${CMD_PREFIX} ostree --repo=repo refs foo > refs
assert_not_file_has_content refs foo
+${CMD_PREFIX} ostree --repo=repo refs --list foo > refs
+assert_file_has_content refs foo
+
${CMD_PREFIX} ostree --repo=repo refs foo | wc -l > refscount.foo
assert_file_has_content refscount.foo "^5$"